
#include "general.h"
#include <wx/sstream.h>
#include <wx/protocol/http.h>
#include "checkthread.h"
#include "wx/file.h"


CCheckThread::CCheckThread(wxWindow* pNotifyReceiver)
{
	m_pNotifyReceiver = pNotifyReceiver;
}

void* CCheckThread::Entry()
{
	wxHTTP http;
	http.Connect(_T("localhost:1425"));

	wxByte buffer[1024];
	wxInputStream* pHttpStream = http.GetInputStream(_T("/operationcateorylist.ashx"));
	wxFile file;
	file.Create(_T("d:\\1.txt"), true);
	while (pHttpStream->Read(buffer, sizeof(buffer)).GetLastError() == wxSTREAM_NO_ERROR)
	{
		file.Write(buffer, pHttpStream->LastRead());
	}
	file.Close();

	delete pHttpStream;

	http.Close();

	return NULL;
}

void CCheckThread::OnExit()
{
}